package com.ykt.converter;

import com.ykt.common.utils.Colls;
import com.ykt.common.utils.ModelUtil;
import com.ykt.model.AgentFee;
import com.ykt.vo.AgentFeeVo;

import java.util.ArrayList;
import java.util.List;

/**
 * @author long.hua
 * @version 1.0.0
 * @since 2016-06-14 23:08
 */
public class AgentFeeConverter {


    public static AgentFeeVo convert(AgentFee model){
        if(model == null){
            return null;
        }

        AgentFeeVo vo = new AgentFeeVo();
        BaseConverter.convert(vo, model);

        vo.setCommunityId(model.getInt(AgentFee.community_id));
        vo.setBegin(ModelUtil.d(model, AgentFee.begin));
        vo.setEnd(ModelUtil.d(model, AgentFee.end));
        vo.setFee(ModelUtil.d(model, AgentFee.fee));
        vo.setSummary(model.getStr(AgentFee.summary));

        return vo;
    }

    public static List<AgentFeeVo> convertList(List<AgentFee> models){
        if(Colls.isEmpty(models)){
            return  null;
        }

        List<AgentFeeVo> vos = new ArrayList<>();
        for (AgentFee model : models) {
            if(model != null){
                vos.add(convert(model));
            }
        }

        return vos;
    }

}
